/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bash.jcouture.util.swing;


import com.bash.compta.data.CategorieDepense;
import com.bash.compta.data.Depense;
import com.bash.compta.db4o.MagicData;

import java.util.List;
import java.util.Locale;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author bashizip
 */
public class RecapitulatifTM extends AbstractTableModel {

  

    private List<CategorieDepense> cats=MagicData.getAllObjects(CategorieDepense.class);

    private String[] colones = {"RECAPITULATIF BUDJET", "USD", "CDF"};

       double totalEfectifs = 0,
                totalUSD = 0,
                totalFC = 0;

   

    public RecapitulatifTM() {
    }

    public int getRowCount() {
        return cats.size();
    }

    public int getColumnCount() {
        return colones.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {

        String cat=cats.get(rowIndex).getLibele();
        Object toReturn = null;

        switch (columnIndex) {
            case 0:
                toReturn = cat;
                break;
            case 1:
                toReturn = MagicData.getTotalUSDOfDepenseType(cat);
                break;
            case 2:

                toReturn = MagicData.getTotalCDFOfDepenseType(cat);
                break;
           

        }
        return toReturn;

    }

    @Override
    public String getColumnName(int column) {
        return colones[column];
    }

    @Override
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
    }
}
